/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 format_string.cpp

	$Header: /heroes4/format_string.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "format_string.h"

#include <cstdio>

static char format_buffer[ 1024 ];

std::string format_string_va_list( char const * format, va_list args )
{

	_vsnprintf( format_buffer, 1023, format, args );

	return std::string( format_buffer );
}

std::string __cdecl format_string( char const * format, ... )
{
	va_list args;
	va_start( args, format );

	std::string result = format_string_va_list( format, args );

	va_end( args );

	return result;
}

std::string __cdecl format_string( std::string format, ... )
{
	va_list args;
	va_start( args, format );

	_vsnprintf( format_buffer, 1023, format.c_str(), args );

	std::string result( format_buffer );

	va_end( args );

	return result;
}
